package com.mygo.designPattern.behavioral.strategicDesignPattern.discount;

import com.mygo.designPattern.behavioral.strategicDesignPattern.DiscountStrategy;

import java.math.BigDecimal;

/**
 * 20% 折扣策略类
 * 实现了DiscountStrategy接口，用于应用20%的折扣
 */
public class TwentyPercentDiscountStrategy implements DiscountStrategy {
    /**
     * 应用20%折扣到给定价格
     *
     * @param price 原始价格
     * @return 打折后的价格
     */
    @Override
    public BigDecimal applyDiscount(BigDecimal price) {
        return price.multiply(BigDecimal.valueOf(0.8));
    }
}
